#ifndef SNAKE_H
#define SNAKE_H

#include <QMainWindow>

namespace Ui {
class Snake;
}

class Snake : public QMainWindow
{
    Q_OBJECT

public:
    explicit Snake(QWidget *parent = 0);
    ~Snake();
    void paintEvent(QPaintEvent *event);
    void InitSnake();
    void keyPressEvent(QKeyEvent *event);
    QRect CreateFood();//产生实物
    void IsEat();
    void IsHit();
private slots:
    void Snake_update();


private:
    Ui::Snake *ui;
    //QRect vSnakeRect;
    QTimer *timer;//定时器
    int nDirection;//🐍移动方向
    bool blsRun;//是否开始
    bool blsOver;//是否结束
    QVector<QRect> vSnakeRect;//🐍
    QRect SnakeHead;//蛇头
    QString Display;
    QRect Food;//食物
    int Score;//得分
    int Speed;
};

#endif // SNAKE_H
